<?
$role = $this->role;
$default = $this->default;
$resources = $this->resources;
$roles = $this->roles;

$action = '/roles/add';
if (isset($role)) {
    $action = '/roles/edit/id/' . $role['id'];
}
?>

<form action="<?= $action ?>" method="post">

    <input type="hidden" name="id" value="<?= $role['id'] ?>">

    <label>New role name:</label>
    <input type="text" name="name" value="<?= $role['name'] ?>"/> <br/>
    <label>Description: </label>
    <input type="text" name="description" value="<?= $role['description'] ?>"/> <br/>

    <div class="privileges">
        <?= $this->partial('/roles/privileges.phtml', array('default' => $default,
                                                           'resources' => $resources,
                                                           'privileges' => $role['privilege'])) ?>
    </div>
    
    <input type="submit" value="Save">
</form>